This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
~Manny Desagenflar 16.May.03 04:33 PM a Web browser Domino Designer6.0All Platforms
I have succesufully created an MS Word object.
It works when trigerred manually.
When I set it scheduled, I got the error :
"Cannot create automation object".
I can't see any front-end classes in my code.
The agent is signed with the server id and I made sure that the folder "Reports" where I temporary store my files exists.
Does it mean that you can't have objects created in scheduled agents ?
It's really urgent, please help ...
TIA,
Daniel Ursache
Here is the code:
Sub Initialize
Dim s As New NotesSession
'Dim ws As New Notesuiworkspace
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim rtitem As Variant
Dim fileCount As Integer, i As Integer
Dim N As Variant
Dim Title As String
fileCount = 0
Set db = s.CurrentDatabase
Set view = db.GetView("ATTACHEDV")
Set doc = view.GetFirstDocument
For i = 1 To view.TopLevelEntryCount
Set temp = view.GetNextDocument(doc)
Set rtitem = doc.GetFirstItem( "Body" )
Forall o In rtitem.EmbeddedObjects
N = o.Name
fileCount = fileCount + 1
Path = "d:\Reports\" & N
Call o.ExtractFile( Path)
'Call o.Remove
Call doc.Save( False, False)
Call Dump(s, db,ws, doc, N, Path)
End Forall
Set doc = temp
Next
End Sub
Function Dump(s, db, ws, doc,N, Path)
Dim FName As String
Set word = createobject( "Word.Application")
word.Visible = False
Set worddoc = word.documents.open( Path )
Set range = worddoc.range()
T = range.Text
word.quit
Set word = Nothing
Old = doc.Text(0)
doc.Text = Old & Chr(10) & Chr(10) & N & Chr(10) & Chr(10) & T
Call doc.Save(True, True)
Dim AtDoc As NotesDocument
Dim Atdb As NotesDatabase
myserver = db.Server
Set Atdb = s.getdatabase(myserver, "Requirements\RepAttachments.nsf")
Set AtDoc = Atdb.CreateDocument
With AtDoc
.Form = "ATTF"
.DateCreated = Now
.CreatedBy = s.CommonUserName
.FileName = N
End With
Dim rtitem2 As NotesRichTextItem
Dim object As NotesEmbeddedObject
Set rtitem2 = New NotesRichTextItem( AtDoc, "Body" )
Set object = rtitem2.EmbedObject ( EMBED_ATTACHMENT, "", Path)
Print " Creating an attachment document ......"
Call AtDoc.Save(True, True)